// index.js
Page({
  data: {
    // 轮播图数据
    bannerList: [
      {
        id: 1,
        imageUrl: '/images/home/1.jpeg'
      },
      {
        id: 2,
        imageUrl: '/images/home/2.jpeg'
      },
      {
        id: 3,
        imageUrl: '/images/home/1.jpeg'
      }
    ],
    // 科室数据
    departmentList: [
      {
        id: 1,
        name: '不孕不育',
        icon: '/images/home/ks/byby.png'
      },
      {
        id: 2,
        name: '排卵障碍',
        icon: '/images/home/ks/plza.png'
      },
      {
        id: 3,
        name: '阳痿早泄',
        icon: '/images/home/ks/ywzx.png'
      },
      {
        id: 4,
        name: '性功能障碍',
        icon: '/images/home/ks/xgnza.png'
      },
      {
        id: 5,
        name: '生殖感染',
        icon: '/images/home/ks/szgr.png'
      },
      {
        id: 6,
        name: '泌尿感染',
        icon: '/images/home/ks/mngr.png'
      },
      {
        id: 7,
        name: '包皮包茎',
        icon: '/images/home/ks/bpbj.png'
      },
      {
        id: 8,
        name: '前列腺增生',
        icon: '/images/home/ks/qlxzs.png'
      }
    ],
    // 医生数据
    doctorList: [
      {
        id: 1,
        name: '展爱华',
        title: '主任医师',
        brief: '中华医学会妇产科学会委员/从医20年',
        specialty: '擅长:妇科炎症、妇科内分泌疾病、多囊卵巢综合征、输卵管疾病等',
        avatar: '/images/image.png'
      },
      {
        id: 2,
        name: '芮松',
        title: '中医主治医师',
        brief: '从医15年',
        specialty: '擅长:中医调理、男性疾病、不孕不育等',
        avatar: '/images/image.png'
      }
    ]
  },

  onLoad: function (options) {
    // 页面加载时执行
  },

  // 轮播图点击事件
  onBannerTap: function(e) {
    const bannerId = e.currentTarget.dataset.id;
    wx.navigateTo({
      url: `/pages/banner/detail?id=${bannerId}`
    });
  },

  // 导航到预约页面
  navigateToAppointment: function() {
    wx.switchTab({
      url: '/pages/appointment/index'
    });
  },

  // 导航到在线咨询页面
  navigateToConsultation: function() {
    wx.navigateTo({
      url: '/pages/consultation/index'
    });
  },

  // 导航到医生团队页面
  navigateToDoctor: function() {
    wx.switchTab({
      url: '/pages/doctor/index'
    });
  },

  // 导航到科室详情页面
  navigateToDepartment: function(e) {
    const departmentId = e.currentTarget.dataset.id;
    wx.navigateTo({
      url: `/pages/department/detail?id=${departmentId}`
    });
  },

  // 导航到更多医生页面
  navigateToMoreDoctors: function() {
    wx.switchTab({
      url: '/pages/doctor/index'
    });
  },

  // 导航到医生详情页面
  navigateToDoctorDetail: function(e) {
    const doctorId = e.currentTarget.dataset.id;
    wx.navigateTo({
      url: `/pages/doctor/detail?id=${doctorId}`
    });
  },

  // 预约挂号
  makeAppointment: function(e) {
    const doctorId = e.currentTarget.dataset.id;
    wx.navigateTo({
      url: `/pages/appointment/make?doctorId=${doctorId}`
    });
  }
});